import 'package:get/get.dart';
import 'package:nyh_motorcade_app/widgets/multi_state/multi_state_widget.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';

class ReportFormsController extends GetxController {
  RefreshController refreshController = RefreshController();
  MultiState multiState = MultiState.loading;
  String date = "今天";
  double amount = 50000.0;
  double quantity = 10000.0;
  int trainNumber = 1500;

  @override
  void onInit() {
    super.onInit();
  }

  @override
  void onReady() {
    super.onReady();
    getData();
  }

  void changeDate() {}

  Future<void> onRefresh() async {
    getData();
  }

  void onRetry() {
    multiState = MultiState.loading;
    update();
    getData();
  }

  void getData() {
    Future.delayed(Duration(seconds: 1)).then((value) {
      if (refreshController.isRefresh) {
        refreshController.refreshCompleted();
      }
      multiState = MultiState.success;
      update();
    });
  }
}
